<?php
namespace App\Service;
use Firebase\JWT\JWT;
use Firebase\JWT\Key;

class JwtService
{
    public static $key='healthcare';
    static function encode($pot){
        $key=self::$key;
        $payload = [
            'pot' => $pot,
        ];
        $jwt = JWT::encode($payload, $key, 'HS256');
        return $jwt;
    }
    static function decode($jwt){
        $key=self::$key;
        $decoded = JWT::decode($jwt, new Key($key, 'HS256'));
        $res['code']=1;
        $res['data']=$decoded;
        return $res;
    }
}
